/**
 * @author nttdocomo
 */
define(function(require) {
	require("./base");
	//aries.augmentString('aries.templates.base',_.template('<div></div>'));
	aries.view("aries.views.Markup", aries.views.Base.extend({
		initialize : function(options) {
			if ($.isArray(options)) {
				_.each(options, function(option) {
					return this.make(option.tagName, attrs);
				})
			}
		},
		_ensureElement : function() {
			aries.views.Base.prototype._ensureElement.apply(this, arguments);
		},
		markup : function(options) {
			var me = this;
			var buffer = [];
			if ($.isArray(options)) {
				_.each(options, function(option) {
					buffer.push(aries.outerHtml(me.make.apply(me, _.values(option))));
				})
			} else {
				return aries.outerHtml(this.make.apply(this, _.values(options)))
			}
			return buffer.join("");
		},
		make : function(tagName, attributes, content) {
			if ($.isArray(tagName)) {

			}
			var el = document.createElement(tagName);
			if (attributes)
				Backbone.$(el).attr(attributes);
			if (content != null) {
				if (!_.isString(content)) {
					content = this.make.apply(this, _.values($.extend({
						tagName : 'div',
						attrs : {},
						content : null
					}, content)));
				}
				return aries.views.Base.prototype.make.apply(this, arguments);
			}
			return el
			/*
			 if (content != null)
			 Backbone.$(el).html(content);
			 return el;*/
		}
	}));
});
